-
Notifications
You must be signed in to change notification settings - Fork 184
Add support for the Filecoin.EthGetStorageAt V2 #6492
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughAdds a Filecoin.EthGetStorageAt V2 RPC method, extracts storage-retrieval logic into a shared async helper used by both V1 and V2, registers the new method in the RPC registry, and adds tests and snapshots for the V2 endpoint. No other public signatures changed. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant RPC as RPC Method (EthGetStorageAtV2)
participant Chain as ChainStore/TipsetResolver
participant State as ActorStateStore
participant VM as VM/Invoker
Client->>RPC: eth_getStorageAt(ethAddress, position, blockNumberOrHash)
RPC->>Chain: tipset_by_block_number_or_hash_v2(...)
Chain-->>RPC: Tipset
RPC->>State: resolve actor address & load state
State-->>RPC: ActorInfo / CodeCID
RPC->>VM: GetStorageAt call (actor, position)
VM-->>RPC: Call result or error
RPC-->>Client: EthBytes (padded) or error
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files
... and 10 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/rpc/methods/eth.rs (1)
2540-2558: Avoid embedded newlines in the RPC description string.The multiline literal includes a newline + indentation in the exposed description. Consider using
concat!(and mirroring the same change in V2) to keep metadata clean.🧹 Suggested formatting
- const DESCRIPTION: Option<&'static str> = Some( - "Retrieves the storage value at a specific position for a contract - at a given block state, identified by its number, hash, or a special tag.", - ); + const DESCRIPTION: Option<&'static str> = Some(concat!( + "Retrieves the storage value at a specific position for a contract ", + "at a given block state, identified by its number, hash, or a special tag.", + ));
🤖 Fix all issues with AI agents
In `@src/rpc/methods/eth.rs`:
- Around line 2590-2648: In get_storage_at, after deserializing
msg_rct.return_data() into ret, guard against ret.len() > EVM_WORD_LENGTH: if
greater, return an error (e.g. Err(anyhow::anyhow!("FVM returned >32 bytes for
storage slot").into())) instead of allowing oversized data through; locate the
check around the variable ret (created from
fvm_ipld_encoding::from_slice::<RawBytes>(...)?.bytes().to_vec()) and add the
length validation before padding/truncation logic so the function either errors
on oversized return data or explicitly truncates to EVM_WORD_LENGTH if you
prefer truncation.
🧹 Nitpick comments (1)
src/rpc/methods/eth.rs (1)
2561-2588: Add rustdoc for the new public RPC enum.[recommendation] This keeps public API docs consistent and discoverable.
📝 Suggested doc comment
-pub enum EthGetStorageAtV2 {} +/// RPC method: Filecoin.EthGetStorageAt (v2). +pub enum EthGetStorageAtV2 {}As per coding guidelines: Document all public functions and structs with rustdoc comments.
Summary of changes
Changes introduced in this pull request:
Filecoin.EthGetStorageAtV2 and added test.Reference issue to close (if applicable)
Closes #6301
Other information and links
Change checklist
Outside contributions
Summary by CodeRabbit
New Features
Tests
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.